package com.cip.admin.dao.impl;

import java.util.List;

import com.cip.admin.dao.ChatDAO;
import com.cip.admin.dao.impl.CipHibernateDAOSupport;
import com.cip.admin.model.Chat;

public class ChatDAOImpl extends CipHibernateDAOSupport implements ChatDAO{
	
	public void saveOrUpdateChat(Chat chat) throws Exception{
		getHibernateTemplate().saveOrUpdate(chat);
	}
	
	public List<Chat> getAllChats(String chatTo) throws Exception{
		String query = "select chat from Chat chat where chat.chatTo='"+chatTo+"' and isReceived='0'";
		List<Chat> chats = getHibernateTemplate().find(query);
		return chats;
	}

}
